﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Schema;
using System.Xml.Serialization;
using CompanyInformationObjects;

namespace XMLTest
{
    class Program
    {

        static void Main(string[] args)
        {
            try
            {

                XElement xelement = XElement.Load(@"C:\Users\hans\Visual Studio\itConnect\itConnect\bin\Release\Options\Journal.opt");

                var locationList = from locationElement in xelement.Elements("cmboJournal")
                                   select locationElement.Value;

                foreach (var location in locationList.ToList())
                {
                    Console.WriteLine(location);
                }
            }
            catch (Exception ex)
            {
                
                Console.WriteLine(ex.Message);
            }
            //try
            //{
            //    XmlValidator.IsValid("Övning_KontoPlan - Copy.xml", "EdisonCompanyInformation.xsd");

            //}
            //catch (XmlValidatorException e)
            //{
            //    Console.WriteLine("The following errors were found:");

            //    foreach (var validationException in e.ValidationExceptions)
            //    {
            //        Console.WriteLine(String.Format("Line number {0}\tLine position: {1}\tMessage: {2}\n",	validationException.Exception.LineNumber,
            //                                                                                                validationException.Exception.LinePosition,
            //                                                                                                validationException.Exception.Message));
            //    }
            //}
            //catch (InvalidOperationException e)
            //{
            //    Console.WriteLine(String.Format("{0}\n{1}",e.Message, e.InnerException));
            //}
            Console.ReadLine();
        }


    }
}

 